home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Windows 95 API Bible
/
Windows 95 API Bible 3 Disc Set.iso
/
Win32 API Bible Book 1 of 3.iso
/
chapte25
/
ex11.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-06-04
|
1KB
|
31 lines
#include <genstub.c>
// Windows message procedure.
LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg)
{
case WM_COMMAND: // Process menu items.
switch ( LOWORD( wParam ) )
{
case IDM_TEST: // Allocate space for message.
{
LPVOID lpText = HeapAlloc( GetProcessHeap(), 0, 32 );
wsprintf( lpText, "The heap address is %lX", lpText );
MessageBox( hWnd, lpText, "GetProcessHeap()", MB_OK );
HeapFree( GetProcessHeap( ), 0, lpText );
}
break;
case IDM_EXIT:
DestroyWindow( hWnd );
break;
}
break;
case WM_DESTROY:
PostQuitMessage( 0 );
break;
default:
return DefWindowProc( hWnd, uMsg, wParam, lParam );
}
return NULL;
}